package com.baosight.xcyber.tm.re.domain;

import com.alibaba.fastjson.JSONObject;
import com.zeroc.IceGrid.*;

import java.util.List;
import java.util.Map;

public class UIApplicationInfo extends UITreeNode{

    Map<String, NodeDescriptor> nodes;

    public UIApplicationInfo(ApplicationInfo applicationInfo){
        this.type="APPLICATION";
        ApplicationDescriptor descriptor = applicationInfo.descriptor;
        name = descriptor.name;
        serverTemplates = descriptor.serverTemplates;
        serviceTemplates = descriptor.serviceTemplates;
        nodes = descriptor.nodes;
        param= (JSONObject) JSONObject.toJSON(descriptor);
        for(Map.Entry<String,NodeDescriptor> node:nodes.entrySet()){
            String nodeName=node.getKey();
            NodeDescriptor nodeDescriptor=node.getValue();
            UINode uiNode = new UINode(nodeName, nodeDescriptor,serverTemplates,serviceTemplates);
            this.getChildren().add(uiNode);
        }
    }
}
